package in.ac.dei.edrp.purchase.flexFieldSettings.keyFlexFieldMaster;



import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Component;

import com.ibatis.sqlmap.client.SqlMapClient;

@Component
@Qualifier("keyFlexFieldSegmentDaoImpl")
public class keyFlexFieldSegmentDaoImpl extends SqlMapClientDaoSupport implements keyFlexFieldSegmentDao
{
	private static Logger logObj = Logger.getLogger(keyFlexFieldSegmentDaoImpl.class);
	keyFlexFieldSegmentDaoImpl (){}
	@Autowired
	public keyFlexFieldSegmentDaoImpl(SqlMapClient sqlMapClient)
	   {
		    setSqlMapClient(sqlMapClient);
	   }
	public List<keyFlexFieldSegmentBean> loadStructureGrid(keyFlexFieldSegmentBean bean) {
		
		List<keyFlexFieldSegmentBean> list = null;
		      try{
			            
		    	   list = getSqlMapClientTemplate().queryForList("keyFlexFieldSegmentSqlMap.loadStructureGrid", bean);
			     }
		         catch(Exception e)
		              {
			              logObj.error("Error inside loadStructureGrid method of keyFlexFieldSegmentDaoImpl Class: ", e);
	             	  } 
			return list;
		}
	
		public List<keyFlexFieldSegmentBean> getAppIdFlexFieldId(keyFlexFieldSegmentBean bean) {
		
		List<keyFlexFieldSegmentBean> list = null;
		      try{
			            
		    	   list = getSqlMapClientTemplate().queryForList("keyFlexFieldSegmentSqlMap.getAppIdFlexFieldId", bean);
			     }
		         catch(Exception e)
		              {
			              logObj.error("Error inside getAppIdFlexFieldId method of keyFlexFieldSegmentDaoImpl Class: ", e);
	             	  } 
			return list;
		}
	
	public List<keyFlexFieldSegmentBean> getFlagStatus(keyFlexFieldSegmentBean bean) {
		
		List<keyFlexFieldSegmentBean> list = null;
		      try{
			            System.out.println("inside getFlagStatus Impl " );
			            System.out.println("hi " + bean.getFlexFieldCode() + " " + bean.getFlexFieldId() );
		    	   list = getSqlMapClientTemplate().queryForList("keyFlexFieldSegmentSqlMap.getFlagStatus", bean);
		    	   System.out.println(list);
		    	   
			     }
		         catch(Exception e)
		              {
			              logObj.error("Error inside getFlagStatus method of keyFlexFieldSegmentDaoImpl Class: ", e);
	             	  } 
		       //  System.out.println("hi " + obj.get("flexFieldId") + " " + obj.get("flexFieldCode") );
			return list;
		}
	
		public String insertRow(keyFlexFieldSegmentBean bean) {
		
			String str = "" ;
		      try{
			            System.out.println("inside insertRow Impl   " );
			            System.out.println("hi   " + bean.getFlexFieldCode() + "   " + bean.getFlexFieldId() );
			            getSqlMapClientTemplate().insert("keyFlexFieldSegmentSqlMap.insertRow", bean);
		    	 //  System.out.println(list);
			            str = "Insert";
		    	   
			     }
		         catch(Exception e)
		              {
			              logObj.error("Error inside insertRow method of keyFlexFieldSegmentDaoImpl Class: ", e);
			              str = "Exception";
		              } 
		       //  System.out.println("hi " + obj.get("flexFieldId") + " " + obj.get("flexFieldCode") );
			return str;
		}
		
		public String editRow(keyFlexFieldSegmentBean bean) {
			
			String str = "" ;
		      try{
			            System.out.println("inside editRow Impl " );
			            System.out.println("hi  " + bean.getFlexFieldCode() + "   " + bean.getFlexFieldId() );
			            getSqlMapClientTemplate().update("keyFlexFieldSegmentSqlMap.editRow", bean);
		    	 //  System.out.println(list);
			            str = "Insert";
		    	   
			     }
		         catch(Exception e)
		              {
			              logObj.error("Error inside editRow method of keyFlexFieldSegmentDaoImpl Class: ", e);
			              str = "Exception";
		              } 
		       //  System.out.println("hi " + obj.get("flexFieldId") + " " + obj.get("flexFieldCode") );
			return str;
		}


		public List<keyFlexFieldSegmentBean> validateValueSet(keyFlexFieldSegmentBean bean) {
			
			List<keyFlexFieldSegmentBean> list = null;
			      try{
				            System.out.println("inside validateValueSet Impl " );
				            
			    	   list = getSqlMapClientTemplate().queryForList("keyFlexFieldSegmentSqlMap.validateValueSet", bean);
			    	   System.out.println(list);
			    	   
				     }
			         catch(Exception e)
			              {
				              logObj.error("Error inside validateValueSet method of keyFlexFieldSegmentDaoImpl Class: ", e);
		             	  } 
			       //  System.out.println("hi " + obj.get("flexFieldId") + " " + obj.get("flexFieldCode") );
				return list;
			}
		
		public List<keyFlexFieldSegmentBean> validateSegmentSummary(keyFlexFieldSegmentBean bean) {
			
			List<keyFlexFieldSegmentBean> list = null;
			      try{
				            System.out.println("inside validateValueSet Impl  " );
				           
			    	   list = getSqlMapClientTemplate().queryForList("keyFlexFieldSegmentSqlMap.validateSegmentSummary", bean);
			    	   
				     }
			         catch(Exception e)
			              {
				              logObj.error("Error inside validateSegmentSummary method of keyFlexFieldSegmentDaoImpl Class: ", e);
		             	  } 
			       //  System.out.println("hi " + obj.get("flexFieldId") + " " + obj.get("flexFieldCode") );
				return list;
			}
}


